package com.cssl.controller;

import com.cssl.domain.DtsBrand;
import com.cssl.service.DtsBrandService;
import com.cssl.util.InfoCode;
import com.cssl.util.Result;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/brand")
@Api(value = "品牌商接口",tags = "品牌商相关操作")
public class BrandController {
    @Autowired
    private DtsBrandService dtsBrandService;

    /**
     * 查询所有品牌信息
     *
     * @return
     */
    @PostMapping("/getBrandList")
    public Result getBrandList() {
        List<DtsBrand> list = dtsBrandService.getAllBrand();
        if (list.size() == 0) {
            return Result.result(InfoCode.QUERY_EMPTY, InfoCode.MESSAGE_QUERY_EMPTY, null, System.currentTimeMillis());
        }
        return Result.result(InfoCode.OK, InfoCode.MESSAGE_OK, list, System.currentTimeMillis());
    }
}
